<template>
  <div>
    <div class="banner" @click="handleBannerClick">
      <img class="banner-img" :src="bannerImg"/>
      <div class="banner-info">
        <div class="banner-title">{{sightName}}</div>
        <div class="banner-number"><span class="iconfont banner-icon">&#xe6d1;</span>{{this.galleryImgs.length}}</div>
      </div>
    </div>
    <fade-animation>
     <common-gallery :imgs="galleryImgs" v-show="showGallery" @close="handleCloseGallery"></common-gallery>
    </fade-animation>
  </div>
</template>
<script>
import CommonGallery from 'common/gallery/Gallery'
import FadeAnimation from '../../../common/fade/Fade'
export default {
  name: 'DetailBanner',
  props: {
    sightName: String,
    bannerImg: String,
    galleryImgs: Array
  },
  data: function () {
    return {
      showGallery: false
    }
  },
  components: {
    FadeAnimation,
    CommonGallery
  },
  methods: {
    handleBannerClick: function () {
      this.showGallery = true
    },
    handleCloseGallery: function () {
      this.showGallery = false
    }
  }
}
</script>
<style lang="stylus" scoped>
  .banner
    position relative
    overflow: hidden
    height: 0
    padding-bottom: 54.9%
    .banner-img
      width: 100%
    .banner-info
      box-sizing: border-box
      padding: 0 .15rem .15rem .15rem
      display: flex
      position: absolute
      left: 0
      right: 0
      bottom: 0
      line-height: .4rem
      color: #fff
      background-image: linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.8))
      .banner-title
        flex: 1
        font-size: .36rem
      .banner-number
        padding: 0 .4rem
        height: .4rem
        line-height: .4rem
        border-radius: .2rem
        background: rgba(0, 0, 0, 0.8)
        font-size: .24rem
        .banner-icon
          font-size: .24rem
          margin-right .15rem

</style>
